﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <title>Index</title>
    <link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
    <link href="~/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="~/Css/base.css" rel="stylesheet" type="text/css" />
    <link href="~/Css/edit_publish_static_project_top_layout.css" rel="stylesheet" type="text/css" />
    <link href="~/Css/publish_project_layout.css" rel="stylesheet" type="text/css"/>
    <script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script>
    <script src="~/Scripts/modernizr-2.6.2.js"></script>
</head>
<body>
    <!--    顶部导航-->
    <div class="edit_header">
        <div class="edit_left">
            <a href="javascript:void(0);" class="back_link" onclick="back()">
                <img src="~/Images/ic-arrow-back-24px.png" />
            </a>
            <div class="header_edit_title" id="header_edit_title"></div>
        </div>
        <div class="edit_right">
            <div class="user_wrap">
                <img src="~/Images/132.png" id="avatar" />
                <!--    弹出层-->
                <div class="user_info">
                    <div class="user_name" id="name">odd</div>
                    <div class="user-exit" id="quit">
                        <i class="glyphicon glyphicon-log-out" style="margin-right:10px;"></i>退出登录
                    </div>
                </div>
            </div>
            <a href="#" class="edit_check">预览</a>

        </div>
        <div class="edit_center">
            <a href="javascript:void(0);" class="edit_center_title" >编辑项目</a>
            <div class="edit_center_icon"></div>
            <a href="javascript:void(0);" class="edit_center_title" style="color: #2672ff !important;border-bottom:2px solid #2672ff">发布项目</a>
            <div class="edit_center_icon"></div>
            <a href="javascript:void(0);" class="edit_center_title" onclick="statistic()">统计报表</a>
        </div>

        <div class="clearfix"></div>
    </div>

    <div class="share_wrap">
        <div class="share_title">项目分享</div>
        <div class="share_info">
            <div class="info_left">
                <div class="info_title">分享链接</div>
                <div class="info_wrap">
                    <div class="share_link" id="share_link"></div>
                    <button class="share_copy btn btn-primary" id="copy_btn" data-clipboard-action="copy" data-clipboard-target="#share_link">复制</button>
                    <button class="share_open btn btn-default" id="open">打开</button>
                </div>
            </div>
            <div class="info_right" id="btn_state">
                <div class="btn_state" id="state_bg">
                    <i id="state_icon" class="icon_state glyphicon glyphicon-play"></i>
                </div>
                <div class="state_title" id="state_title">开始发布</div>
            </div>

            <div class="clearfix"></div>
        </div>
    </div>

    <input class="hidden" id="naire_json" value="@ViewBag.NaireInfo" />

    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script src="~/Scripts/jquery-3.4.1.min.js"></script>
    <script src="~/Scripts/jquery.cookie.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script src="~/Js/publish_project.js"></script>
    <script>
        function getCookie(name) {
            var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
            if (arr = document.cookie.match(reg))
                return unescape(arr[2]);
            else
                return null;
        }
        if (getCookie("user_avatar") != "") {
             $("#avatar")[0].src = getCookie("user_avatar");
        }
        function back() {
            window.location.replace("http://localhost:61507/ProjectList/Index?id="+getCookie("user_id"));
        }
        function edit() {
            window.location.replace("http://localhost:61507/EditProject/Index" + window.location.search);
        }
        function statistic() {
            window.location.replace("http://localhost:61507/StatisticProject/Index" + window.location.search);
        }
        $("#name")[0].innerText = getCookie("user_name");
        $("#quit").click(function () {
            $.cookie('user_id', null, { path: '/' })
            $.cookie('user_account',null,{ path: '/'})
            $.cookie('user_name',null,{ path: '/'})
            $.cookie('user_avatar',null,{ path: '/'})
            $.cookie('user_password',null,{ path: '/'})
            window.location.replace("http://localhost:61507/Login/Index")
        })
        var clipboard = new Clipboard('#copy_btn');
        clipboard.on('success', function (e) {
            alert("复制成功", 1500);
            e.clearSelection();
            console.log(e.clearSelection);
        });
        console.log($("#open")[0]);
        $("#open").click(function () {
            let text = $("#share_link")[0].innerText;
            window.location.replace(text);
        })
    </script>
</body>
</html >
